<%@page import="worker.Worker"%>
<%@page import="java.util.ArrayList"%>
<ul>
<%
	ArrayList<Worker> listWorker= Worker.listWorker;
String action = request.getParameter("action");
if(action != null)
{
	if(action.equals("stop"))
	{
		try{
	for (Worker worker : listWorker) {
		worker.cleanUp();
	}
		} catch (Exception e){
	
		}
		
		response.sendRedirect("index.jsp");
	}
	if(action.equals("add"))
	{
		new Worker();
		response.sendRedirect("index.jsp");
	}
}

int i=0;
for (Worker worker : listWorker) {
	i++;
%>
<li>worker <%=i %></li>
<%
}
%>
<li><a href="index.jsp?action=stop">Stop</a></li>
<li><a href="index.jsp?action=add">New Worker</a></li>
</ul>